package com.ofwiki.demo.scheduler.common;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;

import java.util.concurrent.ScheduledThreadPoolExecutor;


public class SchedulerConfiguration {
    /**
     * 执行任务的线程数量
     */
    @Value("${app.scheduler.thread.count:10}")
    private int schedulerThreadCount;
    

    @Bean
    public DynamicCronScheduleTaskManager dynamicCronScheduleTaskManager() {
        return new DynamicCronScheduleTaskManager(new ScheduledThreadPoolExecutor(schedulerThreadCount));
    }
}
